------------------------------------------------------------
--                   PhysicsBox Beta                      --
--             by TC Studio in Baidu Tieba                --
--         2015,TC Studio,All Rights Reserved             --
--                   Made with Codea                      --
------------------------------------------------------------
displayMode(FULLSCREEN)
supportedOrientations(LANDSCAPE_ANY)

-- 游戏初始化
function setup()
    readSetting()
    timer = Timer(20)
    game = Game()
    startmenu = StartMenu()
    parameter.watch("game.gui.debugs.fps")
end
-- 游戏绘制
function draw()
    timer:advanceTime()
    if GameState.State == Start then
        startmenu:draw()
    else
        for i = 1, timer.ticks do
            tick()
        end
        game:draw(timer.a)
    end
end
-- 触摸绘制
function touched(touch)
    if GameState.State == Start then
        startmenu:touched(touch)
    else
        game:touched(touch)
    end
end
-- 碰撞检测
function collide(contact)
    
end
-- 游戏tick
function tick()
    game:tick()
end